package com.jinyun.controller;

import com.jinyun.service.OrderService;
import com.jinyun.vo.OrderQueryParam;
import com.jinyun.vo.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("order")
@Slf4j
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 查询订单列表
     * @param orderQueryParam
     * @return
     */
    @GetMapping
    public PageResult queryOrderList(OrderQueryParam orderQueryParam){
        return orderService.queryOrderList(orderQueryParam);
    }

    /**
     * 查询订单详情
     * @param orderNumber
     * @return
     */
    @GetMapping("{orderId}")
    public Object queryOrderByOrderNumber(@PathVariable("orderId") String orderNumber){
        return orderService.queryOrderByOrderNumber(orderNumber);
    }
}
